// 设计用户的表模型
const mongoose = require('mongoose')
const Schema = mongoose.Schema

// 设计用户模型
const StuSchema = new Schema({
  username: {
    type: String,
    require: true
  },
  IDNum: {
    type: String,
    require: true
  },
  permission: {
    type: String,
    require: true
  },
  account: {
    type: String,
    require: true,
    unique: true
  },
  password: {
    type: String,
    require: true
  },
  enrollmentYear: {
    type: String,
    require: true
  },
  classes: {
    type: String,
    require: true
  }
})

// 通过 mongoose.model 往数据库里面映射出一张User表
module.exports = mongoose.model('stu', StuSchema)
